import request from '@/utils/request';

import type { ResponseType } from '@/type/ResponseType';

export type FollowParams = {
  type: 'topic' | 'knowledge' | 'doc' | 'disease'
  id: string
}

export type UploadResponse = {
  id: string
  url: string
}

enum Enum {
  followAPI = '/like',
  uploadAPI = '/upload'
}

/**
 * 关注的接口
 * */
export const followAPI = (followParams: FollowParams) => request.post<{ id: string }, ResponseType<{ id: string }>>(Enum.followAPI, followParams);

/**
 * 上传文件的接口
 * */
export const uploadAPI = (file: FormData) => request.post<UploadResponse, ResponseType<UploadResponse>>(Enum.uploadAPI, file);